/**
 * Copyright (c) 2020 kedacom
 * OpenATC is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 * http://license.coscl.org.cn/MulanPSL2
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 **/
package com.openatc.agent.model;


import com.google.gson.JsonElement;
import com.openatc.agent.config.JsonType;
import com.openatc.extend.common.config.array.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;

import javax.persistence.*;
import java.util.List;

@EqualsAndHashCode(callSuper=false)
@Data
@Table(name = "static_route_intersection")
@Entity
@TypeDef(name = "typea",typeClass = IntArrayTypeDescriptor.class)
@TypeDef(name = "json",typeClass = JsonType.class)
public class RouteIntersection extends RouteIntersectionBase{
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    private String name;

    private String type;

    @Type(type = "json")
    @Column(columnDefinition = "json")
    private JsonElement jsonparam;

    private String description;

    @Transient
    private boolean isused;  // 是否启用协调计划


    private int forwardphaseid;
    @Type(type = "typea")
    @Column(columnDefinition = "bytea")
//    @ElementCollection
    private int[] forwardphasedirection;

    private int backphaseid;

    @Type(type = "typea")
    @Column(columnDefinition = "bytea")
//    @ElementCollection
    private int[] backphasedirection;

    private int distance;

    private int width;

    private int sortid;

    private int patternid;

    private String patterndes;

    @Column(name="route_id")
    private Long routeid;

    private String forwardphaseDesc;

    private String backphaseDesc;

    private Integer nextDistance;

}
